package fr.esiag.projet17.constante;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

import org.apache.log4j.Logger;

import fr.esiag.projet17.form.Login;

public class Constante {
	
	private static Logger logPDS = Logger.getLogger(Login.class);

	public static final String FRAME_NAME;
	public static final String SERVER_ADRESS;
	public static final String ABOUT;
	public static final String IMAGE_PATH;
	
	public static Properties loadProperties(String propertiesFileLocation) throws FileNotFoundException, IOException {
		Properties props = new Properties();
		props.load(new FileInputStream(propertiesFileLocation));
		return props;
	}
	
	static {

		Properties p = new Properties();
		try {
			//p = Constante.loadProperties("pds.properties");
			p.load(Constante.class.getResourceAsStream("/pds.properties"));
		} catch (IOException e) {
			e.printStackTrace();
			logPDS.error(e);
		} 


		FRAME_NAME = p.getProperty("FRAME_NAME");
		SERVER_ADRESS = p.getProperty("SERVER_ADRESS");
		ABOUT = p.getProperty("ABOUT");
		IMAGE_PATH = p.getProperty("IMAGE_PATH");
	
	}
	
}